<?php
declare (strict_types = 1);

namespace app\admin\validate;

use think\Validate;

class MarketSMCopywriting extends Validate
{
    /**
     * 定义验证规则
     * 格式：'字段名' =>  ['规则1','规则2'...]
     *
     * @var array
     */
    protected $rule = [
        'id' => 'require|integer',
        'cue_word' => 'max:65535',
        'sm_generate_opywriting_tasks_id' => 'integer',
        'social_media_account_id' => 'integer',
        'platform' => 'require|integer|between:1,10',
        'content' => 'require|max:65535',
        'task_status' => 'require|integer|in:0,1',
        'publish_status' => 'require|integer|in:0,1',
        'redo_num' => 'integer',
        'execution_result' => 'integer',
        'execution_time' => 'integer',
        'mining_machine' => 'max:255',
        'language' => 'integer',
        'status' => 'integer|in:0,1',
        'creator' => 'date',
        'create_time' => 'date',
        'update_time' => 'date',
        'updater' => 'integer',
        'ids' => 'array|require',
        'crypto_news_id' => 'require|integer',
        'language_id' => 'require|integer',
        'channel_id' => 'require|integer',
        'account_group_id' => 'require|integer',
    ];

    // 错误消息
    protected $message = [
        'cue_word.require' => '提示词不能为空',
        'cue_word.max' => '提示词长度不能超过65535个字符',
        'sm_generate_opywriting_tasks_id.integer' => '批量生成社媒文案任务表Id必须为整数',
        'social_media_account_id.integer' => '社媒账号表Id必须为整数',
        'platform.require' => '平台不能为空',
        'platform.integer' => '平台必须为整数',
        'platform.between' => '平台值必须在1到10之间',
        'content.require' => '内容不能为空',
        'content.max' => '内容长度不能超过65535个字符',
        'task_status.require' => '任务状态不能为空',
        'task_status.integer' => '任务状态必须为整数',
        'task_status.in' => '任务状态值必须为0或1',
        'publish_status.require' => '发布状态不能为空',
        'publish_status.integer' => '发布状态必须为整数',
        'publish_status.in' => '发布状态值必须为0或1',
        'redo_num.integer' => '重做次数必须为整数',
        'execution_result.integer' => '执行结果必须为整数',
        'execution_time.integer' => '执行时间必须为整数',
        'crypto_news_id.integer' => '新闻表id必须为整数',
        'mining_machine.max' => '服务器长度不能超过255个字符',
        'language.integer' => '语言必须为整数',
        'status.integer' => '状态必须为整数',
        'status.in' => '状态值必须为0或1',
        'creator.date' => '创建时间格式不正确',
        'create_time.date' => '创建时间格式不正确',
        'update_time.date' => '更新时间格式不正确',
        'updater.integer' => '更新人必须为整数',
    ];

    // 场景设置
    protected $scene = [
        'publish' => ['ids'],
        'regenerate' => ['id'],
        'editContent' => ['id','content'],
        'batchGeneration' => ['crypto_news_id','channel_id','language_id','account_group_id','mining_machine','cue_word']
    ];
}
